<template>
  <div class="list">
    <h1 @click="add">我是组件--{{ list1 }}</h1>
    <p v-for="(item,index) in num" :key="index">
        <span>{{ item.age<=18?'未成年':item.age>100?'百岁老人':item.age>40?'壮年':'青年' }}</span>
        <!-- <span v-if="item.age>18">成年</span>
        <span v-if="item.age<18">未成年</span> -->
    </p>
  </div>
</template>
  <script>
export default {
    props:['list'],
  data() {
    return {
      ming: [],
      list1:'',
      num:[
        {
            age:'2'
        },
        {
            age:'19'
        },
        {
            age:'44'
        },
        {
            age:'8'
        },
        {
            age:'118'
        },
      ]
    };
  },
  mounted() {
    this.list1 =this.list
  },
  methods: {
    add(){
        this.$emit('click','子组件传的值')
    }
  },
};
</script>
  <style>
.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}
.clearfix:after {
  clear: both;
}

.box-card {
  width: 480px;
}
</style>